package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.Question;
import cn.wolfcode.trip.base.mapper.QuestionMapper;
import cn.wolfcode.trip.base.service.IQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class QuestionServiceImpl implements IQuestionService {
    @Autowired
    private QuestionMapper questionMapper;

    @Override
    public List<Question> listAll() {
        return questionMapper.selectAll();
    }

    @Override
    public void save(Question question) {
        question.setCreateTime(new Date());
        questionMapper.insert(question);
    }

    @Override
    public Question selectByQuestionId(Long questionId) {
        return questionMapper.selectByPrimaryKey(questionId);
    }
}
